﻿#pragma once

#include "cocos2d.h"
USING_NS_CC;


#define MAKE_ENUM_STRING(__enum__) #__enum__

#if (CC_TARGET_PLATFORM != CC_PLATFORM_WIN32)

#define ZeroMemory(Destination,Length) memset((Destination),0,(Length))

typedef const char* LPCSTR;

#define UINT unsigned int

#define MAX_PATH          260

#endif//(CC_TARGET_PLATFORM != CC_PLATFORM_WIN32)

#define ASSERT(__assert__) CCAssert(__assert__,"Could not run here...")

#define C_MIN(X1,X2) (X1)<(X2)?(X1):(X2)
#define C_MAX(X1,X2) (X1)<(X2)?(X2):(X1)


#define CREATE_FUNC_1ARG(__TYPE__,__ARG1_TYPE__,__ARG1_NAME__) \
	static __TYPE__* create(__ARG1_TYPE__ __ARG1_NAME__) \
{ \
	__TYPE__ *pRet = new __TYPE__(); \
	if (pRet && pRet->init(__ARG1_NAME__)) \
	{ \
	pRet->autorelease(); \
	return pRet; \
	} \
	else \
	{ \
	delete pRet; \
	pRet = NULL; \
	return NULL; \
	} \
}

#define CREATE_FUNC_2ARG(__TYPE__,__ARG1_TYPE__,__ARG1_NAME__,__ARG2_TYPE__,__ARG2_NAME__) \
	static __TYPE__* create(__ARG1_TYPE__ __ARG1_NAME__,__ARG2_TYPE__ __ARG2_NAME__) \
{ \
	__TYPE__ *pRet = new __TYPE__(); \
	if (pRet && pRet->init(__ARG1_NAME__,__ARG2_NAME__)) \
	{ \
	pRet->autorelease(); \
	return pRet; \
	} \
	else \
	{ \
	delete pRet; \
	pRet = NULL; \
	return NULL; \
	} \
}

#define EPS 0.00001 

//
#define GAME_MAP_DEFINE(__key_name__,__struct_name__) \
	typedef std::map<__key_name__,__struct_name__*> __struct_name__##Map; \
	typedef __struct_name__##Map::value_type __struct_name__##MapType; \
	typedef __struct_name__##Map::iterator __struct_name__##MapIt;

#define GAME_MAP_CLEAR(__struct_name__,__value_name__) \
	for (__struct_name__##MapIt it=__value_name__.begin();it!=__value_name__.end();++it)	\
	{																			\
		CC_SAFE_DELETE(it->second);												\
	}																			\
	__value_name__.clear();

#define GAME_VECTOR_CLEAR(__value_name__) \
	for (unsigned int i=0;i<__value_name__.size();++i)	\
	{																			\
	CC_SAFE_DELETE(__value_name__[i]);												\
	}																			\
	__value_name__.clear();


//
enum EGameSceneType
{
	EGST_MENU,
	EGST_OPTIONS,
	EGST_DEVELOP,
	EGST_THEME_SELECT,
	EGST_LEVEL_SELECT,
	EGST_GAME,
	EGST_HELP,
	EGST_SHOP,
};

//游戏内各个Layer层
enum  EGameLyaer
{
	EGL_MAP_LAYER=-100,		
	EGL_TOWER,
	EGL_LIFE,
	EGL_TOWER_ANIMATION,
	EGL_MONSTER_LAYER,
	EGL_MONSTER_DIE_ANIMATION,
	EGL_BULLET_LAYER,
	EGL_BULLET_DIE_ANIMATION,
	EGL_TOUCH_LAYER,
	EGL_ITEM,
	EGL_MAP_LAYER_ANIMATION,
	EGL_UI,

	EGL_NUM
};


